/*
	FileName : D3Sram4.c
	Description : 
		This file shows how to use D3SRAM.
		
					BASE ADDRESS			SIZE
		-----------------------------------------------------
		D3SRAM		0x38000000				64K(0x10000)
		
				
	Created on 2018.10.10 by ZZP.
	
	Revision History:
	
*/

#include "stdint.h"
#include "app.h"
#include "wifi.h"
#include "wifi_data.h"

///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///					define variables in D3SRAM: examples
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
#if defined (__CC_ARM)

///*************************************************************
///*************************************************************
///D3SRAM: address=0x38000000; size=0x10000
///*************************************************************
///*************************************************************
#define D3SRAM_LIMIT		0x39000000u

#if ((defined BSP_D3SRAM_ENABLE) && (BSP_D3SRAM_ENABLE==DEF_ENABLED))

/////////////////////////////////////////////////////
///Caution: 
///every variable address must be calculated!
/////////////////////////////////////////////////////
#define _ADDR_0		(0x38000000)
__attribute__((at(0x38000000))) STS_FRAME StsFrame[STS_BUF_SIZE];

#define _ADDR_1		(0x38000000+sizeof(StsFrame))
__attribute__((at(_ADDR_1))) uint8_t Jw_TestBuf[512];

#define _ADDR_2		(_ADDR_1+sizeof(Jw_TestBuf))
	
#if (DEBUG_TASK_STATS==1)
#define SIZE_OF_DEBUGBUF		SIZE_OF_STATUS_BUF
__attribute__((at(_ADDR_2))) signed char DebugBuf[SIZE_OF_STATUS_BUF];
#else
#define SIZE_OF_DEBUGBUF		0u
#endif///DEBUG_TASK_STATS

#define _ADDR_3		(_ADDR_2+SIZE_OF_DEBUGBUF)
__attribute__((at(_ADDR_3))) xTaskStatusType pxTaskStatusBuf[32];

#define _ADDR_4		(_ADDR_3+sizeof(pxTaskStatusBuf))
///__attribute__((at(_ADDR_4))) uint8_t gau8SocketTestBuffer[MAIN_WIFI_M2M_BUFFER_SIZE];
	
#define _ADDR_5		(_ADDR_4+sizeof(gau8SocketTestBuffer))
__attribute__((at(_ADDR_5))) uint8_t Usart1RxBuf[USART1_RX_BUF_SIZE];

#define _ADDR_6		(_ADDR_5+sizeof(Usart1RxBuf))
__attribute__((at(_ADDR_6))) uint8_t Usart1TxBuf[USART1_TX_BUF_SIZE];

#define _ADDR_7		(_ADDR_6+sizeof(Usart1TxBuf))
__attribute__((at(_ADDR_7))) uint8_t _tmpRxBuf1[USART1_RX_BUF_SIZE];

#define _ADDR_8		(_ADDR_7+sizeof(_tmpRxBuf1))
__attribute__((at(_ADDR_8))) uint8_t _tmpTxBuf1[USART1_TX_BUF_SIZE>>1];

#define _ADDR_9		(_ADDR_8+sizeof(_tmpTxBuf1))
__attribute__((at(_ADDR_9))) uint8_t Usart4RxBuf[USART4_RX_BUF_SIZE];

#define _ADDR_10	(_ADDR_9+sizeof(Usart4RxBuf))
__attribute__((at(_ADDR_10))) uint8_t _tmpRxBuf4[USART4_RX_BUF_SIZE];


/*
#define _TOP_ADDR	_ADDR_9
#if (_TOP_ADDR>D3SRAM_LIMIT)
#error "D3SRAM : max length = 64K bytes. exceeded."
#endif
*/




#endif///BSP_D3SRAM_ENABLE

#endif///__CC_ARM





